//
//  CustomLabel.m
//  产业头条
//
//  Created by ZJ on 16/12/1.
//  Copyright © 2016年 ZJ. All rights reserved.
//

#import "CustomLabel.h"
#import "ZJAdditions.h"
@implementation CustomLabel

- (instancetype)init {
    if (self = [super init]) {
        _textInsets = UIEdgeInsetsZero;
    }
    return self;
}

- (instancetype)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        _textInsets = UIEdgeInsetsZero;
    }
    return self;
}

- (void)drawTextInRect:(CGRect)rect {
    [super drawTextInRect:UIEdgeInsetsInsetRect(rect, _textInsets)];
}


- (void)setText:(NSString *)text{
    [super setText:text];
    
    self.textInsets = UIEdgeInsetsMake(self.textInsets.top, self.textInsets.left, self.height - self.textInsets.top - [NSString sizeOfString:self.text font:15 *[UIScreen zj_textFontScale] width:(self.width - self.textInsets.left - self.textInsets.right)].height, self.textInsets.right);
}




@end
